package com.yzc.android.manager;

import android.text.TextUtils;

import com.yzc.android.beans.UserInfoBean;

/**
 * Created by yzc on 16/4/7.
 */
public enum AccountManager {
    INSTANCE;

    private UserInfoBean mUserInfoBean;

    private enum UserLoginState {
        LoginOut(0),//未登陆
        LoginIn(1);//已登陆

        private int value;

        UserLoginState(int value) {
            this.value = value;
        }

        public int getValue() {
            return value;
        }

        public static UserLoginState valueOf(int value) {
            if (value == 0) return LoginOut;
            if (value == 1) return LoginIn;
            return LoginOut;
        }
    }

    private UserLoginState mUserLoginState;


    public static AccountManager getInstance()
    {
        return INSTANCE;
    }

    public boolean isLogin()
    {
        boolean result = false;
        if (mUserLoginState == UserLoginState.LoginIn)
        {
            result = true;
        }
        else if (TextUtils.isEmpty(mUserInfoBean.userName))
        {
            result = true;
        }
        return result;
    }

    public void setUserLoginState(UserLoginState loginState)
    {
        this.mUserLoginState = loginState;
    }
}
